package com.itheima.udp2;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class ClientDemo {

    public static void main(String[] args) throws Exception {
        //创建发送对象
        DatagramSocket ds = new DatagramSocket();
        //组织数据
        byte[] bytes = "发给组播的你真帅".getBytes();
        //224.0.1.0~224.255.255.255
        DatagramPacket dp = new DatagramPacket(bytes, bytes.length, InetAddress.getByName("224.0.1.0"), 8888);
        // 发送
        ds.send(dp);
        //释放资源
        ds.close();
    }
}
